import javax.swing.*;
import java.util.Scanner;

public class Search_sum {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int target = 8;
        int[] arr = {1,2,5,7,9};
        int i,j = 0;
        for(i = 0; i < arr.length; i++){
            for (j = i + 1; j < arr.length; j++){
                if(arr[i] + arr[j] == target){
                    System.out.println("他们的下标分别是"+i+"和"+j);
                }
            }
        }
    }
}
